package com.oncecloud.devops.service.sample.config;

import com.oncecloud.devops.service.sample.common.JenkinsItem;

public class JenkinsJobXmls {
	public static String jobxml;
	public static String getJobxml(JenkinsItem jenkinsItem){
		jobxml="<?xml version='1.0' encoding='UTF-8'?>                                                                               "+
				"<maven2-moduleset plugin=\"maven-plugin@2.15.1\">                                                                      "+
				"  <description></description>                                                                                        "+
				"  <keepDependencies>false</keepDependencies>                                                                         "+
				"  <properties/>                                                                                                      "+
				"  <scm class=\"hudson.plugins.git.GitSCM\" plugin=\"git@3.3.0\">                                                         "+
				"    <configVersion>2</configVersion>                                                                                 "+
				"    <userRemoteConfigs>                                                                                              "+
				"      <hudson.plugins.git.UserRemoteConfig>                                                                          "+
				"        <url>"+jenkinsItem.getRepository_url()+"</url>                                                          "+
				"      </hudson.plugins.git.UserRemoteConfig>                                                                         "+
				"    </userRemoteConfigs>                                                                                             "+
				"    <branches>                                                                                                       "+
				"      <hudson.plugins.git.BranchSpec>                                                                                "+
				"        <name>"+jenkinsItem.getBranch_specifier()+"</name>                                                                                        "+
				"      </hudson.plugins.git.BranchSpec>                                                                               "+
				"    </branches>                                                                                                      "+
				"    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>                                     "+
				"    <submoduleCfg class=\"list\"/>                                                                                     "+
				"    <extensions/>                                                                                                    "+
				"  </scm>                                                                                                             "+
				"  <canRoam>true</canRoam>                                                                                            "+
				"  <disabled>false</disabled>                                                                                         "+
				"  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>                                         "+
				"  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>                                             "+
				"  <triggers/>                                                                                                        "+
				"  <concurrentBuild>false</concurrentBuild>                                                                           "+
				"  <aggregatorStyleBuild>true</aggregatorStyleBuild>                                                                  "+
				"  <incrementalBuild>false</incrementalBuild>                                                                         "+
				"  <ignoreUpstremChanges>false</ignoreUpstremChanges>                                                                 "+
				"  <ignoreUnsuccessfulUpstreams>false</ignoreUnsuccessfulUpstreams>                                                   "+
				"  <archivingDisabled>false</archivingDisabled>                                                                       "+
				"  <siteArchivingDisabled>false</siteArchivingDisabled>                                                               "+
				"  <fingerprintingDisabled>false</fingerprintingDisabled>                                                             "+
				"  <resolveDependencies>false</resolveDependencies>                                                                   "+
				"  <processPlugins>false</processPlugins>                                                                             "+
				"  <mavenValidationLevel>-1</mavenValidationLevel>                                                                    "+
				"  <runHeadless>false</runHeadless>                                                                                   "+
				"  <disableTriggerDownstreamProjects>false</disableTriggerDownstreamProjects>                                         "+
				"  <blockTriggerWhenBuilding>true</blockTriggerWhenBuilding>                                                          "+
				"  <settings class=\"jenkins.mvn.DefaultSettingsProvider\"/>                                                            "+
				"  <globalSettings class=\"jenkins.mvn.DefaultGlobalSettingsProvider\"/>                                                "+
				"  <reporters/>                                                                                                       "+
				"  <publishers/>                                                                                                      "+
				"  <buildWrappers/>                                                                                                   "+
				"  <prebuilders/>                                                                                                     "+
				"  <postbuilders>                                                                                                     "+
				"    <hudson.tasks.Shell>                                                                                             "+
				"      <command>"+jenkinsItem.getCommand()+"</command>  "+
				"    </hudson.tasks.Shell>                                                                                            "+
				"  </postbuilders>                                                                                                    "+
				"  <runPostStepsIfResult>                                                                                             "+
				"    <name>FAILURE</name>                                                                                             "+
				"    <ordinal>2</ordinal>                                                                                             "+
				"    <color>RED</color>                                                                                               "+
				"    <completeBuild>true</completeBuild>                                                                              "+
				"  </runPostStepsIfResult>                                                                                            "+
				"</maven2-moduleset>                                                                                                  ";
		return jobxml;
	}
}
